Initialization problems for Java

نویسندگان

  • Egon Börger
  • Wolfram Schulte
چکیده

We exhibit a grey area in the speciication of Java and of its implementation through the Java Virtual Machine (JVM): the treatment of initialization of classes and interfaces. We report the result of our experiments with diierent implementations of Java, which connrm the theoretical prediction of our work on mathematical models for Java 4] and the JVM 3], namely that the designers of Java and the JVM have used notions of initialization which do not match and which aaict the portability of Java programs. We show also that concurrent initialization may deadlock and that various current Java compilers violate the initialization semantics through standard optimization techniques. 1 The Initialization Problem Any programming language that supports libraries of autonomous components has to determine when to initialize a library component. Examples of components are modules, packages or classes. In traditional block oriented languages, like Pascal, C or C++, a global variable is associated with the initialization status of a component. This variable is initialized in the main program. However, this does not work for modern object-oriented languages like Eiiel or Java. By deenition they do not have a main program. Additionally, Java's support for dynamic class loading requires that initialization should be lazy, that is, it should take place just before a rst use of any item declared in a class. An additional complication is caused by parallel threads that try to initialize the same class at the same time. Through two recent studies, where we provide a mathematical deenition of the meaning of Java 4] and prove a natural scheme for compilation of Java on the Java Virtual Machine (JVM) to be correct 3], we discovered the following problems with initialization in Java and its implementations: { The exact moment when initializers for static elds in interfaces are executed is underspeciied in the Java Language Speciication (JLS) 6]. They can either be initialized when an interface eld is rst used, or when a class (an interface) that implements (extends) the interface is initialized. { The JLS and the JVM Speciication (JVMS) 7] use semantically diierent and connicting concepts to de-ne when a class or interface is initialized. Whereas the JLS uses the concept of rst active use to trigger class or interface initialization, the JVM implements the initialization as a mandatory step of its (constant pool) resolution process. This process, however, is also triggered for instructions whose execution does not constitute …

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Eager Class Initialization for Java

We describe a static analysis method on Java bytecode to determine class initialization dependencies This method can be used for eager class loading and initialization It catches many initialization circularities that are missed by the standard lazy implementation Except for contrived examples the computed initialization order gives the same results as standard lazy initialization

متن کامل

A Type System for Object Initialization in the Java Bytecode Language (summary)

In the standard Java implementation, a Java language program is compiled to Java bytecode and this bytecode is then interpreted by the Java Virtual Machine. Since bytecode may be written by hand, or corrupted during network transmission, the Java Virtual Machine contains a bytecode veriier that performs a number of consistency checks before code is interpreted. As one-step towards a formal spec...

متن کامل

Towards Verification of Software Product Lines: The JBook Case Study

Scaling verification to large programs is a long-standing problem. There is a growing community of researchers that believe verification must be intimately integrated with software design and modularity for scaling to occur; verification of programs should not be an after-thought. In this presentation, we explore an approach that suggests how feature modularization can scale verification to pro...

متن کامل

DEVELOPING A NEW INITIALIZATION PROCEDURE FOR DISTILLATION COLUMN SIMULATION

  The simulation of distillation columns is an essential step in design, optimization, and rating. In this paper, a new procedure has been proposed for the initial estimation of column profiles based on modified Kremser’s group method for simple and/or complex columns. The effect of this initialization algorithm on simulation procedure has been studied through two examples. The results show sig...

متن کامل

Creating and Visualizing Test Data from Programming Exercises

Automatic assessment of programming exercises is typically based on testing approach. Most automatic assessment frameworks execute tests and evaluate test results automatically, but the test data generation is not automated. No matter that automatic test data generation techniques and tools are available. We have researched how the Java PathFinder software model checker can be adopted to the sp...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • Software - Concepts and Tools

دوره 19  شماره 

صفحات  -

تاریخ انتشار 2000